<?php
namespace Home\Controller;
use Think\Controller;
class ProductController extends Controller{
	function index(){
		$productOb= M('product');
		$re=$productOb->select();
		$proImgOb=M('productimage');
		
		foreach ($re as $k => $v) {
			$id =$v['id'];
			$image=$proImgOb->where("productid=$id")
						->find();
			$re[$k]['imagename']=$image['imagename'];	
			}	
		$this->assign('re',$re);
		$this->display();
	}
	// foreach($arr as $k=>$v){
	// 		$productid=$v['id'];
	// 		$typestr=$v['typestr'];
	// 		$str=typeidToStr($typestr);
	// 		$arr[$k]['typestr']=$str;
	// 		//图片
	// 		$imageArr=$productimage->where("productid=$productid")->find();
	// 		if($imageArr){
	// 			$arr[$k]['imagename']=$imageArr['imagename'];
	// 		}else{
	// 			$arr[$k]['imagename']="no.jpg";
	// 		}
	function detail(){

		$this->display();
	}
}